package com.alquimia.identityaccess.application.events.user;

import com.alquimia.identityaccess.application.events.RegisteredEvent;
import com.alquimia.identityaccess.domain.model.User;

/**
 * Created by Ivo on 16/07/2014.
 */
public class UserRegisteredEvent extends RegisteredEvent {

    private String userId;
    private String username;
    private String firstName;
    private String lastName;
    private String emailAddress;

    public UserRegisteredEvent(User aUser) {
        super();

        this.initializeFrom(aUser);
    }

    public String getUsername() {
        return username;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public String getEmailAddress() {
        return emailAddress;
    }

    public String getUserId() {
        return userId;
    }

    private void initializeFrom(User aUser) {
        this.emailAddress = aUser.person().emailAddress().address();
        this.firstName = aUser.person().fullName().firstName();
        this.lastName = aUser.person().fullName().lastName();
        this.userId = aUser.userId().id().toString();
        this.username = aUser.username();
    }


}
